package com.ks.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ks.product.dao.ProductMapper;
import com.ks.product.entity.Product;
import com.ks.product.model.request.ReqDecreaseStockDto;
import com.ks.product.service.IProductService;
import org.springframework.stereotype.Service;

@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {

    @Override
    public void decreaseStock(ReqDecreaseStockDto request) {
        Product product = getById(1L);
        product.setQuantity(product.getQuantity() - request.getQuantity());
        updateById(product);
    }
}
